import java.util.Arrays;

public class test {
    public static String MytoString(int[] array){
        if(array == null){
            return "null";
        }
        if(array.length == 0){
            return "[]";
        }
        String ret = "[";
        for (int i = 0; i < array.length; i++) {
            ret += array[i];
           if(i != array.length-1){
               ret += ",";
           }
        }
        ret += "]";
        return ret;
    }
    public static int[] transform(int[] array){
        int[] tmp = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            tmp[i] = array[i] * 2;
        }
        return tmp;
    }
    public static int[] reverse(int[] array){
        int m = 0;
        int[] tmp = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 ==1){
                tmp[m] = array[i];
                m++;
            }
        }
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 == 0){
                tmp[m] = array[i];
                m++;
            }
        }
    return tmp;
    }
    /*public static int[] add(int[] array,int target){
        int[] tmp = new int[2];
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if(array[i] + array[j] == target){
                    tmp[0] = i;
                    tmp[1] = j;
                }
            }*/
       /* }
        return tmp;
    }
    public static int one(int[] array){
        int single = 0;
        for (int x: array) {
            single ^= x;
        }
        return single;
    }
    public static int majorityElement(int[] nums) {
        Arrays.sort(nums);
        return nums[nums.length/2];
    }
    public static boolean odd(int[] array){
        for (int i = 0; i < array.length-2; i++) {
            if(array[i] % 2 == 1 && array[i+1] % 2 == 1 && array[i+2] % 2 == 1){
                return true;
            }
        }
        return false;
    }*/
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5,6};
        int[] m = reverse(array);
        String s = Arrays.toString(m);
        System.out.println(s);
    }
}
